using PyPlot
function doMandelbrot(x, y, scale, steps = 80)
res = 800
range = -scale:(2*scale/res):scale
f(c, x = 0, i = 0) = i >= steps || abs(x) > 2 ? i : f(c, x^2+c, i+1)
z = [ f(yy + xx * im) for xx = y .+ range, yy = x .+ range ]
imshow(z, origin = "lower", extent=[x-scale, x+scale, y-scale, y+scale], cmap="ocean_r")
nothing
end
doMandelbrot(0, 0, 2)
doMandelbrot(0.365, 0.591, 2^-11)
zoom = 5e8; time = 25; steps = (30, 1000)
frames = 400; sz = (6, 6)
#frames = 20; sz = (2, 2)
pt = (0.365022915, 0.59105223)
###
fig = figure(figsize = sz)
withfig(fig) do
ani = matplotlib.animation.FuncAnimation(fig,
i -> doMandelbrot(pt[1], pt[2], 2/zoom^(i/frames), steps[1]*(steps[2]/steps[1])^(i/frames)),
frames = frames, interval = time*1e3/frames)
display("text/html", ani.to_html5_video())
end
nothing